id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

String Operationssplit

prev  |  next  |  chance

The int() function truncates values. int(5/2) equals 2

def split(out, word):
    length = int(len(out) / 2)
    return out[:length] + word + out[length:]
Function Call  Return Value
split('Hello', 'World')
split('Person', 'a')
split('Alpha', 'Omega')
split('Rain', 'boots')
split('School', 'bus')
split('', 'Hi')
split('Matt', '')
split('5', '8')

Experiment with this code on Gitpod.io

⬅ Back